---
title: 'Trade Competitiveness, Constituency Interests, and Legislators’ Attitudes Towards Trade Agreements'
author: Andreas Dür, Robert A. Huber, and Yannick Stiller
output:
  rmdformats::downcute:
    self_contained: true
    thumbnails: true
    lightbox: true
    gallery: false
    highlight: tango
editor_options:
  chunk_output_type: console
---

```{r globopt, include = F}
knitr::opts_chunk$set(warning = FALSE)
```

In this notebook, we explain the replication of our paper in LSQ. 

# How to proceed

First download all files available from the Harvard Dataverse in a folder of choice. The next steps of the analysis are outlined in the script below.

# Prepare analysis

First download all files from the project file "replication_materials_LSQ.Rproj" to a folder of your choice. Open it in R-Studio and load the "README.Rmd" file. The next lines of code automatically set the working directory. 

```{r, message=FALSE}
# Set wd with here() package

here::i_am("replication_materials_LSQ.Rproj")

# Clean Environment
rm(list = ls())
```

The files should cover the following:

```{r}
#List of files
list.files()
list.files("./rcode/")
list.files("./data/")
list.files("./figures/")
list.files("./tables/")
```

Please ensure the folder structure is the same on your local device. 

# Analysis of the data

Open the R-Script "analysis.R" from the subfolder rcode. It contains all steps to replicate our findings. This contains all models reported in the paper and appendix. For section F, see "data_quality.R".

```{r, message=FALSE, results='hide', fig.keep='none'}
 
source("./rcode/analysis.R")
 
```

Open the R-Script "data_quality.R" from the subfolder rcode. It contains all steps to replicate our data quality asssessment present in Section F of the Appendix.

```{r, message=FALSE, fig.keep='none'}

source("./rcode/data_quality.R")

```

# Session Info

This notebook was run using the following setup:

```{r}
pander::pander(sessionInfo())
```
